﻿using System;
using System.Collections.Generic;
using System.Text;
using Telerik.Web.UI;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace CarbonExchange.WebControls
{
    public class RadGridEditColumn : GridEditCommandColumn
    {
        public override void PrepareCell(System.Web.UI.WebControls.TableCell cell, GridItem item)
        {
            base.PrepareCell(cell, item);
            if (item is GridDataItem)
            {
                foreach (Control ctrl in cell.Controls)
                {
                    LinkButton tmp = ctrl as LinkButton;
                    if (tmp != null)
                    {
                        if (tmp.CommandName == "Edit")
                        {
                            tmp.CssClass = "edit";
                        }
                        else if (tmp.CommandName == "Update" || tmp.CommandName == "PerformInsert")
                        {
                            tmp.CssClass = "save";
                        }
                        else if (tmp.CommandName == "Cancel")
                        {
                            tmp.CssClass = "cancel";
                        }
                    }
                }
            }
        }
    }
}
